﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ICE.Vacations.Helper.Services
{
    public class Services
    {
        public enum errorType { ConfigurationError, DBError, IIFError, SuccessMessage, InformationMessage };

        private static string message(int error, string description)
        {
            return DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss':'fff") + " - " + Logger.ErrorMessage((int)error) + " - " + description + "\r\n";
        }

        public static void sendLog(string description, errorType error, Exception exc = null, string action = "", int cantidad = 0)
        {
            if (Logger.ifWrite((int)error))
            {
                #region File Write
                if (Logger.ifFileWrite())
                {
                    try
                    {
                        Logger.fileWrite(message((int)error, description));
                    }
                    catch { }
                }
                #endregion

            }
        }

    }
}
